new Vue({
  el: '#app',
  data() {
    return {
      form: {
        Article_Name: "",
        Category_SerialNumber: "",
        Enterprise_Info_SerialNumber: $.cookie("enterprise"),
        Type: "1",
        token: $.cookie("token"),
        page: 1,			//页数
        limit: 10,			//每页数据条数
      },
     
      form1: {
        // Article_Name: "",
        hotspot: '1',  //0是消息1消息条数
        Type: "1",   //1是自己0是全部
        Row_Status: '',  //空是全部0是未读1是已读
        token: $.cookie("token"),
        Enterprise_Info_SerialNumber: $.cookie("enterprise"),
        page: 1,			//页数
        limit: 10,			//每页数据条数
      },
      total: 0,
      badge: '',  //消息条数
      category: [],
      Enterprise: [],
      tableData: [],
      loading: false,
      activeindex: 0,
      Enterprise_Info_SerialNumber: $.cookie("enterprise")
    }
  },
  mounted() {
    
    //默认查询第一组数据
    this.getList(this.form)
    //消息条数
    this.getbadge(this.form1)
  
  },
  methods: {
    expand(row){
      let _this = this;
      $.ajax({
        url: DomainName + '/getGroupTransactionAllAction?token=' +$.cookie('token'),
        type: 'POST',
        data:row.form,
        success: function (res) {
          row.orderData = res.tableData
          row.total=parseInt(res.limit)
          console.log('888',row,res.limit)
        }
      })
      
    },
    handleCurrentChange1(e,row) {
      console.log('00000000000000000',e)
      row.form.page = e
      this.expand(row)
    },
    handleSizeChange1(e,row) {
      console.log('1111111111111111111111111111',e,row)
     row.form.page = 1
      row.form.limit = e
      this.expand(row)
    },
    //通过关键字查询数据
    onSerach() {
      this.getList(this.form)
    },
    //号码按键查询
    handleSizeChange(val) {
      this.form.page = 1;
      this.form.limit = val;
      this.getList(this.form)
    },
    //号码按键查询
    handleCurrentChange(val) {
      this.form.page = val;
      this.getList(this.form)
    },
    //获取消息条数
    getbadge(data) {
      let _this = this
      $.ajax({
        type: 'POST',
        data,
        url: DomainName + '/getGroupMessageAllAction',
        success: function (Result) {
          // _this.tableData = Result.tableData;
          console.log(Result, 1111)
          _this.badge = Result.limit
          // _this.total = parseInt(Result.limit)
        },
        complete: function (XMLHttpRequest) {
          if (XMLHttpRequest.getResponseHeader("REDIRECT") == "REDIRECT") {
            window.parent.document.location.href = "../../../" + XMLHttpRequest.getResponseHeader("CONTENTPATH");
          }
        },
        dataType: "json"
      })
    },
    //分页查询数据
    getList(data) {
      let _this = this
      $.ajax({
        type: 'POST',
        data,
        url: DomainName + '/getGroupProcureAllAction',
        success: function (Result) {
          console.log(Result)
          _this.tableData = Result.tableData;

          _this.total = parseInt(Result.limit)
        },
        complete: function (XMLHttpRequest) {
          if (XMLHttpRequest.getResponseHeader("REDIRECT") == "REDIRECT") {
            window.parent.document.location.href = "../../../" + XMLHttpRequest.getResponseHeader("CONTENTPATH");
          }
        },
        dataType: "json"
      })
    },
    //跳转到消息界面
    mymessage() {
      window.location.href = './Message.html'
    },
    //跳转到增加界面
    addEnterprise() {
      window.location.href = './Add.html'
    },
    //跳转到详情
    bidding() {
      window.location.href = './Bidding.html'
    },
    detail(e,row) {
      console.log('点击按钮',e,row)
          window.location.href = './Detailrecords.html?Group_Transaction_SerialNumber=' +row.Group_Transaction_SerialNumber
          sessionStorage.setItem("Group_Transaction_SerialNumber",row.Group_Transaction_SerialNumber)
          sessionStorage.setItem("Group_Purchasing_SerialNumber",row.Group_Purchasing_SerialNumber)

    }
  },
}) 

